var t_url = "https://hehua.ai-zuoye.cn/lotus1912/"
//login
function login(_skey, _callback) {
	$.ajax({         
		url: t_url + "user/login",
		data: {
			"skey": _skey
		},
		type: "get",
		//async:false,    //同步（默认为true，异步）
		dataType: "json",
		success: function(datas) {
			console.log("登陆信息", datas);
			if(datas["code"] == 0){
				_callback.call(this, datas)
			}else{
				alert(datas["msg"])
			}
		}
	})
}
//获取手机验证码
function getCode(_skey, _phone,_callback) {
	$.ajax({         
		url: t_url + "user/getCode",
		data: {
			"skey": _skey,
			"phone":_phone
		},
		type: "get",
		//async:false,    //同步（默认为true，异步）
		dataType: "json",
		success: function(datas) {
			console.log("获取手机验证码", datas);
			if(datas["code"] == 0){
				_callback.call(this, datas)
			}else{
				alert(datas["msg"])
			}
		}
	})
}
//上传手机号
function setUser(_skey, _phone,_code,_callback) {
	$.ajax({         
		url: t_url + "user/setUser",
		data: {
			"skey": _skey,
			"phone":_phone,
			"code":_code
		},
		type: "post",
		//async:false,    //同步（默认为true，异步）
		dataType: "json",
		success: function(datas) {
			console.log("上传手机号", datas);
			if(datas["code"] == 0){
				_callback.call(this, datas)
			}else{
				alert(datas["msg"])
			}
		}
	})
}
//获取收货地址
function getAddress(_skey,_callback) {
	$.ajax({         
		url: t_url + "user/getAddress",
		data: {
			"skey": _skey
		},
		type: "post",
		//async:false,    //同步（默认为true，异步）
		dataType: "json",
		success: function(datas) {
			console.log("获取收货地址", datas);
			if(datas["code"] == 0){
				_callback.call(this, datas)
			}else{
				alert(datas["msg"])
			}
		}
	})
}
//添加收货地址
function setAddress(_skey,_phone,_province,_city,_district,_address,_callback) {
	$.ajax({         
		url: t_url + "user/setAddress",
		data: {
			"skey": _skey,
			"phone":_phone,
			"province":_province,
			"city":_city,
			"district":_district,
			"address":_address
		},
		type: "post",
		//async:false,    //同步（默认为true，异步）
		dataType: "json",
		success: function(datas) {
			console.log("添加收货地址", datas);
			if(datas["code"] == 0){
				_callback.call(this, datas)
			}else{
				alert(datas["msg"])
			}
		}
	})
}
